<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="http://at.alicdn.com/t/c/font_2592779_u9zya6masq.css">
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            padding-top: 100px;
            color: #ccc;
        }

        .form {
            width: 300px;
            height: 400px;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 4px 2px #ccc;
            margin: auto;
        }

        .row {
            display: flex;
            padding: 10px 0 10px 0;
        }

        .row>span:first-child {
            width: 60px;
            line-height: 34px;
        }

        .row>span:last-child {
            flex: 1;
            padding-right: 10px;
        }

        .logo {
            width: 100%;
            text-align: center;
        }

        .logo .iconfont {
            font-size: 100px;
            color: #da0;
        }

        input {
            padding: 0;
            border: 1px solid #ccc;
            width: 100%;
            height: 34px;
            border-radius: 6px;
            padding-left: 10px;
        }

        .secrite {
            position: relative;
        }

        .secrite .iconfont {
            position: absolute;
            top: 4px;
            right: 4px;
            cursor: pointer;
            font-size: 30px;
        }
    </style>
</head>

<body>
    <div class="form">
        <div class="row">
            <div class="logo">
                <i class="iconfont icon-Moneybox"></i>
            </div>
        </div>
        <div class="row">
            <span>用户名:</span>
            <span>

                <input type="text" placeholder="请输入用户名">
            </span>
        </div>
        <div class="row">
            <span>密　码:</span>
            <span class="secrite">
                <i class="iconfont icon-yanjing_yincang" title="查看密码"></i>
                <input type="password" placeholder="请输入密码" id="pwd">
            </span>
        </div>
    </div>

    <script>
        let eye = document.querySelector('.secrite .iconfont');
        let pwd = document.getElementById('pwd');
        eye.onclick = function () {
            if (this.classList.contains('icon-yanjing_yincang')) {
                this.classList.remove('icon-yanjing_yincang');
                this.classList.add('icon-yanjing_xianshi');
                pwd.type = 'text'
                this.title = '隐藏密码'
            } else {
                this.classList.remove('icon-yanjing_xianshi');
                this.classList.add('icon-yanjing_yincang');
                pwd.type = 'password'
                this.title = '查看密码'
            }
        }
    </script>
</body>

</html>